<!DOCTYPE html>
<!-- saved from url=(0029)http://k.ilib.io/u/clock.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <title></title>

    <style>
        body {
          color: #000000;
          background-color: #ffffff;
        }

        .page {
          position: fixed;
          width: 100%;
          height: 100%;
        }

        .time_container,
        .date_container,
        .weather_container {
          width: 100%;
          margin: auto;
          text-align: center;
        }

        .time_container {
          top: 0;
          height: 50%;
        }

        .date_container {
          top: 0;
          height: 30%;
        }

        .time {
          padding-top: 120px;
          font-size: 12rem;
        }

        .date {
          padding-top: 0px;
          font-size: 4rem;
        }

        .weather_container {
          top: 0;
          height: 55%;
        }

        .weather_date {
          font-size: 2rem;
        }
    </style>
</head>

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://pv.sohu.com/cityjson"></script>

<body>
    <div class="page">
      <div class="time_container">
          <div class="time" id="time">23:49</div>
      </div>

      <div class="date_container">
          <div class="date" id="date">5月17日</div>
          <div class="date" id="week">星期五</div>
      </div>

      <div class="weather_container">
          <div class="weather_date" id="weather1">北京</div>
          <div class="weather_date" id="weather2">99℃~99℃</div>
          <div class="weather_date" id="weather3">雷阵雨</div>
      </div>
    </div>
    

    <script>
      var userip;
      var weatherData;
      
      //获得IP
      $(function(){
          userip = returnCitySN["cip"];
      });
      
      //获得天气信息
      function getWeather() {
        var args = {"version":"v1","ip":userip,callback:"","time":new Date()};
          $.ajax({
            type:'GET',
            url:"https://www.tianqiapi.com/api/",
            data:args,
            success:function(data){
                weatherData = data;
                upWeather();
            }
          });
      }
      
      function upWeather() {
        $('#weather1').html(weatherData.city);
        $('#weather2').html(weatherData.data[0].tem2 + "~" + weatherData.data[0].tem1);
        $('#weather3').html(weatherData.data[0].wea);
      }

      //更新时间
      function update() {
        var date = new Date()
        var utc8DiffMinutes = date.getTimezoneOffset() + 480
        date.setMinutes(date.getMinutes() + utc8DiffMinutes)

        var timeString = date.getHours() + ':' + ('0' + date.getMinutes()).slice(-2)
        var dateString = (date.getMonth() + 1) + '月' + date.getDate() + '日'
        var weekList = ['日', '一', '二', '三', '四', '五', '六']
        var weekString = '星期' + weekList[date.getDay()]

        document.getElementById("time").innerHTML = timeString
        document.getElementById("date").innerHTML = dateString
        document.getElementById("week").innerHTML = weekString
      }

      //更新时间
      update()
      setInterval("update()", 60 * 1000)
      
      //更新天气（一个小时一次）
      getWeather()
      setInterval("getWeather()", 60 * 60 * 1000)
    </script>

</body></html>